<template>
  <div class="container" v-title data-title="检测端首页">
  <ul class="word">
    <li @click="toCheckCar">检测车辆</li>
    <li @click="toBingCar">绑定车辆</li>
  </ul>
    <simplert ref="simplert"></simplert>
  </div>
</template>

<script>
  import Simplert from '../../components/dialog/dialog.vue'
  let filters = {
    parseURL:function(url) {
      let a = document.createElement('a');
      a.href = url;
      return {
        params: (function () {
          let ret = {},
            param = a.href.split('?')[1],
            seg = param.split('&'),
            len = seg.length,
            i = 0,
            s;
          for (; i < len; i++) {
            if (!seg[i]) {
              continue;
            }
            s = seg[i].split('=');
            ret[s[0]] = s[1];
          }
          return ret;
        })()
      }
    }
  };

  export default {
    data () {
      return {
        token:"",
        id:''
      }
    },
    created () {

    },
    mounted(){
      const that = this;
      const url = window.location.href;
      // this.id = filters.parseURL(url).params.id;
      this.$util.getUserToken().then(token=>{
        that.token = token;
      })
      let root = process.env.MAIN_ROOT;
    },
    components: {
      Simplert
    },
    methods: {
      open (title, confirmBtn,customConfirmBtnText,onConfirm,type,onClose,message) {
        let obj = {
          title: title,
          useConfirmBtn: confirmBtn,
          customConfirmBtnText: customConfirmBtnText,
          onConfirm:onConfirm,
          type: type,
          onClose:onClose,
          message:message
        }
        this.$refs.simplert.openSimplert(obj)
      },
      toBingCar(){
        this.$router.push({path: '/device/bindCar', query: { id: 12 }});
      },
      toCheckCar(){
        this.$router.push({path: '/device/checkCar', query: { id: 12 }});
      },
    }
  }
</script>
<style scoped >
  @import "../styles/styles.css";
  .container{  width: 100%; height: 100%; position: relative;}
  .word{
    position: absolute;
    left:0;
    right:0;
    top: 50%;
    transform: translate(0, -50%);
    -webkit-transform:translate(0, -50%);
    -moz-transform:translate(0, -50%);
    -ms-transform:translate(0, -50%);
    -o-transform:translate(0, -50%);
  }
  .word li{
    width:80%;
    margin:0 auto 0.2rem auto;
    height:0.8rem;
    line-height: 0.8rem;
    text-align: center;
    background: #009EA6;
    color:#fff;
    border-radius: 0.1rem;
    font-size: 0.26rem;
  }
</style>
